<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
        <br/>
        <div align="left">
            <p:selectOneMenu value="#{datasourceBackingBean.selectedPlugin}" id="plugin">
                <f:ajax listener="#{datasourceBackingBean.selectedPluginAction}"  render="renderPanel"/>
                <f:selectItem itemLabel="#{i18n['common.select.defaultLabel']}" />
                <c:forEach items="#{datasourceBackingBean.plugins}" var="plugin">
                    <f:selectItem itemLabel="#{plugin.simpleName}" itemValue="#{plugin.name}"/>
                </c:forEach>
            </p:selectOneMenu>
        </div>
             <br/>
             <h:panelGrid  id="renderPanel">
             <p:panel header="Datasource" id="datasource" rendered="#{datasourceBackingBean.localDatasource}">
                <table width="100%">
                    <tr>
                        <td align="left">
                            <p:inputText value="com.farmcode.runtime.driver" disabled="true" style="width: 180px"/>
                        </td>
                        <td align="left">
                            <p:inputText   style="width: 450px" value="#{datasourceBackingBean.driver}"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <p:inputText value="com.farmcode.runtime.host" disabled="true" style="width: 180px"/>
                        </td>
                        <td align="left">
                            <p:inputText   style="width: 450px" value="#{datasourceBackingBean.host}"/>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <p:inputText value="com.farmcode.runtime.schema" disabled="true" style="width: 180px"/>
                        </td>
                        <td align="left">
                            <p:inputText value="#{datasourceBackingBean.schema}" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <p:inputText value="com.farmcode.runtime.user" disabled="true" style="width: 180px"/>
                        </td>
                        <td align="left">
                            <p:inputText value="#{datasourceBackingBean.user}" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <p:inputText value="com.farmcode.runtime.password" disabled="true" style="width: 180px"/>
                        </td>
                        <td align="left">
                            <p:password value="#{datasourceBackingBean.password}" redisplay="true"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="right">
                            <p:commandButton value="Test" action="#{datasourceBackingBean.testConnection}" update="messages"/>
                            <p:commandButton value="Clear" action="#{datasourceBackingBean.clear}" update="messages, datasource"/>
                        </td>
                    </tr>
                </table>
            </p:panel>
                 </h:panelGrid>
    </body>
</html>